Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@ledgerhq/devices
Advanced tools
@ledgerhq/devices is an npm package that provides a comprehensive set of tools and utilities for interacting with Ledger hardware wallets. It includes functionalities for managing device information, handling firmware updates, and interfacing with various Ledger applications.
List Supported Devices
This feature allows you to retrieve information about a specific Ledger device model. In this example, the code fetches details about the Ledger Nano S model.
const { getDeviceModel } = require('@ledgerhq/devices');
const deviceModel = getDeviceModel('nanoS');
console.log(deviceModel);
Identify Device by USB Product ID
This feature helps you identify a Ledger device based on its USB product ID. The code sample demonstrates how to get device information using a specific USB product ID.
const { identifyUSBProductId } = require('@ledgerhq/devices');
const deviceInfo = identifyUSBProductId(0x0001);
console.log(deviceInfo);
List All Devices
This feature provides a list of all supported Ledger devices. The code sample prints out the entire list of devices supported by the @ledgerhq/devices package.
const { devices } = require('@ledgerhq/devices');
console.log(devices);
Logic for all Ledger devices.
The USB product IDs will be defined as MMII, encoding a model (MM) and an interface bitfield (II)
Model Ledger Nano S : 0x10 Ledger Blue : 0x00 Ledger Nano X : 0x40
Interface support bitfield Generic HID : 0x01 Keyboard HID : 0x02 U2F : 0x04 CCID : 0x08 WebUSB : 0x10
Type: number
Type: number
Returns DeviceModel
usbProductId
numberReturns DeviceModel?
uuid
stringReturns BluetoothInfos?
Type: $Keys<any>
Type: {id: DeviceModelId, productName: string, productIdMM: number, legacyUsbProductId: number, usbOnly: boolean, memorySize: number, blockSize: number, bluetoothSpec: Array<{serviceUuid: string, writeUuid: string, notifyUuid: string}>?}
id
DeviceModelIdproductName
stringproductIdMM
numberlegacyUsbProductId
numberusbOnly
booleanmemorySize
numberblockSize
numberbluetoothSpec
Array<{serviceUuid: string, writeUuid: string, notifyUuid: string}>?Type: {deviceModel: DeviceModel, serviceUuid: string, writeUuid: string, notifyUuid: string}
deviceModel
DeviceModelserviceUuid
stringwriteUuid
stringnotifyUuid
stringType: {id: string, productName: string, usbProductId: number, usbOnly: boolean, bluetoothSpec: Array<{serviceUuid: string, writeUuid: string, notifyUuid: string}>?}
master
id
DeviceModelIdproductName
stringusbProductId
numberusbOnly
booleanbluetoothSpec
Array<{serviceUuid: string, writeUuid: string, notifyUuid: string}>?Type: {deviceModel: DeviceModel, serviceUuid: string, writeUuid: string, notifyUuid: string}
deviceModel
DeviceModelserviceUuid
stringwriteUuid
stringnotifyUuid
stringFAQs
Ledger devices
The npm package @ledgerhq/devices receives a total of 163,200 weekly downloads. As such, @ledgerhq/devices popularity was classified as popular.
We found that @ledgerhq/devices demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.